<?php
require "./mObserverable.class.php";

class mObserverableTest extends PHPUnit_Framework_TestCase{
    public function testRegister(){
        
	$doSomethine = new doSomething();
	$doThisThing = new doThisThing();
	
        $first = new testO('minbaby');
	$sen   = new testO('who?');
	
        $doSomethine->register($first);
	$doSomethine->register($sen);
	
        $doSomethine->test();
	
	echo '________________', PHP_EOL;
	
	$doSomethine->remove($first);
        $doSomethine->test();
    }
}

class testO implements mObserver{
    
    public function __construct($name){
	$this->name = $name;
    }
    
    public function update($observer) {
        echo date('Y-m-d H:i:s'), $this->name, PHP_EOL;
    }
}

class doSomething extends mObserverable{
     
    public function test(){
        $this->notifyObserver();
    }
}

class doThisThing extends mObserverable{
	public function fuck(){
		//to-do someting
		$this->nofiyObserver();
	}
	
}